package com.yiqi.lottery.feature.documentary.view.adapter;

import android.text.Html;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.BindView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suozhang.framework.framework.AM;
import com.suozhang.framework.utils.T;
import com.yiqi.lottery.R;
import com.yiqi.lottery.common.util.DateTool;
import com.yiqi.lottery.entity.bo.BeetingBo;
import com.yiqi.lottery.entity.bo.OrderBo;
import com.yiqi.lottery.entity.bo.OrderListBo;

public class BeetingListAdapter extends BaseQuickAdapter<OrderListBo, BaseViewHolder> {
    private int type;

    public BeetingListAdapter(int type) {
        super(R.layout.item_user_beeting);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderListBo item) {
        String stauts="";
        if (type==9){
            if (item.getCurrent_user()!=null&&item.getCurrent_user().getCopurce()!=null){
                if (item.getCurrent_user().getCopurce().getStatus()==1){
                    stauts="待开奖";
                }else if (item.getCurrent_user().getCopurce().getStatus()==2){
                    stauts="未中奖";
                }else if (item.getCurrent_user().getCopurce().getStatus()==3){
                    stauts="已中奖";
                }
            }

        }else {
            if (item.getOrder_status()==1){
                stauts="待开奖";
            }else if (item.getOrder_status()==2){
                stauts="未中奖";
            }else if (item.getOrder_status()==3){
                stauts="已中奖";
            }
        }


        helper.setText(R.id.tv_user_order_type_mname, item.getBet_label())
                .setText(R.id.tv_user_order_prize, Html.fromHtml("<font color=\"#6B6B6B\">订单价 :</font> " + (type==9?item.getAmount_fee():item.getOrder_amount())+ "元"))
                .setText(R.id.tv_user_order_state, Html.fromHtml(item.getOrder_status()==3?"<font color=\"#6B6B6B\">状态 :</font> <font color=\"#D83200\">"+stauts+"</font>":"<font color=\"#6B6B6B\">状态 :</font> "+stauts+""))
                .setText(R.id.tv_user_order_date, Html.fromHtml("<font color=\"#6B6B6B\">日期 : " + DateTool.TimeStamp2Date(item.getCreated_at()) + "</font>"))
                .setVisible(R.id.btn_order_fadan, type == 3&&item.getBet_type()!=1 ? true : false)
                .addOnClickListener(R.id.btn_order_fadan);

        switch (item.getBet_type()) {
            case 1 :
                AM.image().bindToCircleObject(R.drawable.ic_number_lotto, helper.getView(R.id.iv_user_order_logo));
                break;
            case 2 ://sfc
                AM.image().bindToCircleObject(R.drawable.ic_lottery_win, helper.getView(R.id.iv_user_order_logo));
                break;
            case 3 ://sfc
                AM.image().bindToCircleObject(R.drawable.ic_lottery_nine, helper.getView(R.id.iv_user_order_logo));
                break;
            case 4 ://足球
                AM.image().bindToCircleObject(R.drawable.ic_lottery_football, helper.getView(R.id.iv_user_order_logo));
                break;
            case 5 ://篮球
                AM.image().bindToCircleObject(R.drawable.ic_lottery_basketball, helper.getView(R.id.iv_user_order_logo));
                break;

        }

    }
}
